"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.野马Handler = void 0;
const Config_1 = require("../../Config");
const GameUtils_1 = __importDefault(require("../GameUtils"));
const BaseHandler_1 = require("./BaseHandler");
class 野马Handler extends BaseHandler_1.BaseHandler {
    /** 跃踏
     *  不能攻击小子和核心
     */
    impact(data, player) {
        this.handlerMgr.spendAction(player, Config_1.Config.COST_野马_IMPACT);
        let startPoint = this.gameMgr.map_point.get(data.start);
        let endPoint = this.gameMgr.map_point.get(data.end);
        let big_start = startPoint.big;
        big_start.actionOnce();
        let small = endPoint.small;
        let big_end = endPoint.big;
        if (small != null) {
            //小子被攻击
            small.die(player);
        }
        else if (big_end != null) {
            //大子被攻击
            if (big_end.attacked(player)) {
                //打过了
            }
            else {
                //攻击没打过，自己死亡
                big_start.die(player, endPoint.id);
                return;
            }
        }
        //没有大子，就是移动
        startPoint.big = null;
        endPoint.big = big_start;
        big_start.point = endPoint;
        this.gameMgr.sendBroadcast(GameUtils_1.default.getObj("野马_践踏", { "start": data.start, "end": data.end }));
        big_start.terrainAdapt();
    }
}
exports.野马Handler = 野马Handler;
